/*
 * @Author: yxiawen
 * @Date: 2022-01-24 15:04:46
 * @LastEditTime: 2022-01-24 15:18:20
 * @LastEditors: yxiawen
 * @Description:
 * @FilePath: /vite-project/mock/user.js
 */
const Mock = require("mockjs");

export default [
  {
    url: "/admin/login/doLogin",
    method: "POST",
    response: ({ body }) => {
      if (body.name === "admin" && body.pwd === "admin") {
        return Mock.mock({
          code: 0,
          message: "ok",
          type: "success",
          data: {
            token: "@paragraph( 18 )",
            user: {
              id: "@integer(0, 100)",
              realname: "@cname( 4 )",
              role: "administrator"
            }
          }
        });
      } else {
        return {
          code: 1,
          message: "fail",
          type: "error",
          data: null
        };
      }
    }
  }
];
